package com.order.Mapper;

import com.api.entity.UserCourseOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/*
    @ClassName OrderMapper
    @Description TODO
    @Date 2021/9/3、10:54
*/
@Mapper
@Repository
public interface OrderMapper extends BaseMapper<UserCourseOrder> {

    @Select("select u.course_id from user_course_order u where user_id = #{userId} and status = 20")
    List<Integer> getOrderByUserId(int userId);

    @Insert("insert into user_course_order(order_no,status,is_del) values(# {orderNo},#{status},#{isDel})")
    void addOrder(UserCourseOrder order);

}
